package com.foreknow.demo03;

import java.util.Scanner;

/**
 * 已知一个数组{1,23,56,13,56,78,90,26,112}计算数组中的平均值、最大值、最小值
 */

public class LianXi1 {

    public static int[] pop (int[] array){
        for(int i = 0;i<array.length;i++) {
            if ((array[i]%2)==0){
                System.out.println(array[i]);
            }
            }
      return array;
    }

    public static void a(){
        int[] a={1,23,56,13,56,78,90,26,112};
        int s = (1+23+56+13+56+78+90+26+112)/9;
        int max=a[0];
        int min=a[0];
        for (int i=1;i<a.length;i++){
            if (a[i]>max){
                max=a[i];
            }
            if (a[i]<min){
                min=a[i];
            }

        }
        System.out.println("本数组最大值为："+max);
        System.out.println("本数组最小值为："+min);
        System.out.println("本数组平均值为:"+s);
    }




    public static void main(String[] args) {
        System.out.println("第一题******************");
        Scanner input = new Scanner(System.in);
        int[] array = new int[10];
        for (int i=0;i<array.length;i++){
            System.out.println("请输入一个整数");
            array[i]=input.nextInt();
        }
        int[] arr = LianXi1.pop(array);



        System.out.println("第二题***************");


        LianXi1.a();

    }




}
